{% extends "base.html" %}

{% block content %}
    <style>
        /* 隐藏顶部导航栏 */
        nav.navbar {
            display: none !important;
        }

        :root {
            --primary-color: #4361ee;
            --dark-bg: #121212;
            --card-bg: #1e1e1e;
            --text-color: #f8f9fa;
            --input-bg: #2d2d2d;
            --input-border: #444;
            --input-focus: #4361ee;
        }

        body {
            background-color: var(--dark-bg);
            color: var(--text-color);
            min-height: 100vh;
            display: flex;
            align-items: center;
            padding: 0;
            margin: 0;
        }

        .container {
            width: 100%;
            padding: 0 15px;
        }

        .login-card {
            background: var(--card-bg);
            border: none;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            overflow: hidden;
            margin: 0 auto;
            max-width: 500px;
        }

        .login-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
        }

        .card-header {
            background: var(--primary-color);
            color: white;
            font-weight: 600;
            letter-spacing: 1px;
            padding: 1.5rem;
            text-align: center;
            font-size: 1.5rem;
            border-bottom: none;
        }

        .card-body {
            padding: 2rem;
        }

        .form-control {
            background-color: var(--input-bg);
            border: 1px solid var(--input-border);
            color: var(--text-color);
            padding: 12px 15px;
            border-radius: 8px;
            transition: all 0.3s;
        }

        .form-control:focus {
            background-color: var(--input-bg);
            border-color: var(--input-focus);
            box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
            color: var(--text-color);
        }

        .form-label {
            font-weight: 500;
            margin-bottom: 0.5rem;
            color: #ddd;
        }

        .btn-primary {
            background-color: var(--primary-color);
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            font-weight: 500;
            letter-spacing: 0.5px;
            width: 100%;
            margin-top: 1rem;
            transition: all 0.3s;
        }

        .btn-primary:hover {
            background-color: #3a56d4;
            transform: translateY(-2px);
        }

        /* 添加一些装饰元素 */
        .login-card::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 4px;
            background: linear-gradient(90deg, #4361ee, #3a0ca3);
        }

        /* 新增加载提示框样式 */
        .loading-alert {
            position: fixed;
            top: 20px;
            right: 20px;
            background-color: #28a745;
            color: white;
            padding: 15px 25px;
            border-radius: 5px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            display: none;
            z-index: 1000;
            animation: fadeIn 0.3s ease-out;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
    <!-- 新增加载提示框HTML -->
    <div id="loadingAlert" class="loading-alert">
        <i class="fas fa-spinner fa-spin me-2"></i>正在登录中...
    </div>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-12">
                <div class="login-card card">
                    <div class="card-header">欢迎登录图书管理系统</div>
                    <div class="card-body">


                    <form method="POST" id="loginForm">
                        {% csrf_token %}
                        <div class="mb-4">
                            <label for="username" class="form-label">用户名</label>
                            <input type="text" class="form-control" id="username" name="username" required
                                   placeholder="请输入用户名">
                        </div>
                        <div class="mb-4">
                            <label for="password" class="form-label">密码</label>
                            <input type="password" class="form-control" id="password" name="password" required
                                   placeholder="请输入密码">
                        </div>
                        <button type="submit" class="btn btn-primary">
                            <i class="fas fa-sign-in-alt me-2"></i>登录
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

    <!-- 如果需要使用Font Awesome图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <script>
    // 确保DOM完全加载后再执行
    document.addEventListener('DOMContentLoaded', function() {
        const loginForm = document.getElementById('loginForm');
        const loadingAlert = document.getElementById('loadingAlert');

        if (loginForm) {
            loginForm.addEventListener('submit', function(e) {
                e.preventDefault();

                // 显示加载提示
                loadingAlert.style.display = 'block';

                // 3秒后提交表单
                setTimeout(() => {
                    this.submit();
                }, 3000);
            });
        }
    });
    </script>
{% endblock %}